<?php
$pagination = $_['pagination'];
$resumes = $_['resumes'];
$keyword = $_['keyword'];
$app = PFactory::getApplication();
$limit = $app->getUserStateFromRequest('resumes.limit', 'limit', 8, 'int');
?>

<script language="javascript" type="text/javascript">
   jQuery(document).ready(function($) {
      <?php if($pagination->pagesTotal > 1): ?>
         $("#search_resume_resut .list-footer:first").pager({ 
            pageCount: <?php echo $pagination->pagesTotal; ?>,
            currentPage: <?php echo ($pagination->pagesCurrent -1); ?>
         }).delegate("li.active", "click", function(e) {
            var page = parseInt($(this).attr('page'));
            var url = getUrlQuery(OC.filePath('resumes', 'ajax', 'search.resume.php'),"type=1&limitstart=" + (page * <?=$limit?>) + '&keyword=<?php echo rawurlencode($keyword); ?>');
            var target = $(this);
            $.ajax({
               url: url,
               beforeSend: function(xhr, settings) {
                  showLoading(target, settings, null, {button:true});
               },
               success: function(data) {
                  jQuery("#search_resume_resut").fadeOut("fast", function() {
                     jQuery("#search_resume_resut").html(data).fadeIn();
                  });
               }
            })
         }).parent().show();
      <?php endif; ?> 
   })

   $('.notsearchresult').hide();
</script>
<?php if(!empty($resumes)): ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr>
      <th width="65">姓名</th>
      <th width="150">邮箱</th>
      <th width="100">手机号</th>
      <th width="150">申请职位</th>
      <th width="75">工作经验</th>
      <th width="40">学历</th>
      <th width="35" style="text-align:center;">选择</th>
   </tr>
   <?php
      foreach($resumes as $key=>$resume){
         $viewURL =OCP\Util::linkToRoute('resume_view', array('id' => '')).$resume->id.'&name='.JFilterOutput::stringURLUnicodeSlug($resume->name);
         $href='';
         
         echo "<tr id=\"chooseresume_$resume->id\" data=\"{'jobseekerid':'".$resume->id."','jobseekername':'". addslashes($resume->name)."','jobid':'".$resume->job_id."','jobtitle':'".addslashes($resume->job_title)."','jobsystem':'".$resume->jobsystem."','validemail':'".(isFakeEmail($resume->email) ? 0 : 1)."'}\">";
         echo '<td><a href="'.$viewURL.'" target="_blank">'.$resume->name.'</a></td>';
         echo '<td>'.(!isFakeEmail($resume->email)?$resume->email:'--').'</td>';
         echo '<td>'.$resume->phone.'</td>';

         if(empty($resume->jobsystem)){
            $posURL = OC_Helper::linkToRoute('jobpos_setup').'?id='.$resume->jobid.'&job_title='.JFilterOutput::stringURLUnicodeSlug($resume->job_title);
            $href = '<a href='.$posURL.' target="_blank">';
            echo '<td data-jobid='.$resume->jobid.' class="editByJobid">'.$href.$resume->job_title.'</a></td>';
         }else{
            echo '<td>--</td>';
         }
         echo '<td>'.(empty($resume->workexp_summary)?($resume->source!='upload' ? '应届毕业生': '--'):$resume->workexp_summary).'</td>';
         echo '<td>'.(empty($resume->highest_education_degree_level)?'--':$resume->highest_education_degree_level).'</td>';
         echo '<td align="center"><input type="radio" name="chooseresume" value='.$resume->id.' /></td>';
         echo '</tr>';
      }
   ?>
</table>
<tr>
   <td colspan="8" class="row3" style="display: <?php echo ($pagination->pagesTotal > 1) ? '' : 'none'?>">
   <?php
      echo '<div class="list-footer"></div>'; 
   ?>
   </td>
</tr>
<?php else: ?>
<div class="nosearchdata">简历不存在，您可以重新搜索或者 <a href="<?php echo OC_Helper::linkToRoute('resume_showaddform');?>" target="_blank">创建一份简历</a></div>
<?php endif;?>
